using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace FutureCorePlugin
{
    public static class PlatformUtil
    {
        public static string PlatformName
        {
            get
            {
#if UNITY_EDITOR
                BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
                switch (target)
                {
                    case BuildTarget.StandaloneWindows:
                    case BuildTarget.StandaloneWindows64:
                        return "windows";
                    case BuildTarget.Android:
                        return "android";
                    case BuildTarget.iOS:
                        return "ios";
                    case BuildTarget.StandaloneOSXIntel:
                    case BuildTarget.StandaloneOSXIntel64:
                    case BuildTarget.StandaloneOSXUniversal:
                        return "osx";
                    case BuildTarget.WebGL:
                        return "webgl";
                    default:
                        return null;
                }
#else
                RuntimePlatform platform = Application.platform;
                switch (platform)
                {
                    case RuntimePlatform.WindowsPlayer:
                    case RuntimePlatform.WindowsEditor:
                        return "windows";
                    case RuntimePlatform.Android:
                        return "android";
                    case RuntimePlatform.IPhonePlayer:
                        return "ios";
                    case RuntimePlatform.OSXPlayer:
                        return "osx";
                    case RuntimePlatform.WebGLPlayer:
                        return "webgl";
                    default:
                        return null;
                }
#endif
            }
        }

        public static bool IsEditor
        {
            get
            {
                bool retValue = false;
#if UNITY_EDITOR
                retValue = true;
#endif
                return retValue;
            }
        }

        public static bool IsStandalone
        {
            get
            {
                bool retValue = false;
#if UNITY_STANDALONE
                retValue = true;
#endif
                return retValue;
            }
        }

        public static bool IsAndroid
        {
            get
            {
                bool retValue = false;
#if UNITY_ANDROID
                retValue = true;
#endif
                return retValue;
            }
        }

        public static bool IsiOS
        {
            get
            {
                bool retValue = false;
#if UNITY_IOS
                retValue = true;
#endif
                return retValue;
            }
        }
    }
}